#ifndef MUSICLIST_H
#define MUSICLIST_H

#include <QtGui>
#include "Track.h"

class MusicList : public QObject
{
	Q_OBJECT
	private:
	QVector<Track*> list;
	int mode;
	int position;
	QVector<Track*> lastPlayedList;
	
	public:
	MusicList(QObject* parent=0);
	int getPosition();
	int getMode();
	void add(Track* track, bool resolved=false);
	void remove(int index);
	void remove(Track* track);
	Track* operator[](int index);
	void setMode(int mode);
	Track* next();
	Track* previous();
	Track* first();
	Track* last();
	int size();
	void saveToM3U(QString& playlistPath);
	void saveToPLS(QString& playlistPath);
	void loadFromM3U(QString& playlistPath);
	void loadFromPLS(QString& playlistPath);
	void saveToXML();
	void loadFromXML();
	static int getRandomNumber(int min, int max);
	Track* seek(int index);
	
	public slots:
	void onTrackMetaDataResolved(int trackId);
	signals:
	void dataChange(int row);
	void dataAdded();
};

#endif
